package indi.zhifa.learn.jenkins.helloworld2.web.service.algorithm.datastructure;

import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class DocResultSet {
    List<PassResultItem> passResults;
    public DocResultSet(){
        passResults = new ArrayList<>();
    }

    public Map<String,Object> getValues(){
        Map<String,Object> results = new HashMap<>();
        for(PassResultItem passResultItem : passResults){
            if(passResultItem.isSuccess()){
                List<DocValueResult> docValueResultList = passResultItem.getResults();
                for(DocValueResult docValueResult : docValueResultList){
                    if(docValueResult.isSuccess()){
                        results.put(docValueResult.getKey(),docValueResult.getValue());
                    }
                }
            }
        }
        return results;
    }
}
